home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 for Intel / NeXTSTEP 3.2 for Intel.iso / Upgrader.app / Default.upgrade / PreProcess < prev    next >
Encoding:
Text File  |  1993-10-15  |  7.7 KB  |  227 lines

  1. #!/bin/csh -f
  2. #
  3. # Upgrader pre-processing script for 2.X systems.
  4.  
  5. set     path = (/bin /usr/bin /etc /usr/etc /usr/ucb)
  6. unalias *
  7.  
  8. if ($#argv != 2) then
  9.     echo "Usage: PreProcess targroot sourceroot"
  10.     exit 1
  11. endif
  12.  
  13. set target = $argv[1]
  14. set source = $argv[2]
  15. set docleanup
  16.  
  17. echo Preparing $target for upgrade...
  18.  
  19. if (-f ${target}/usr/lib/NextStep/software_version) then
  20.     set sourcevers = `head -1 ${target}/usr/lib/NextStep/software_version`
  21. else
  22.     set sourcevers = `head -1 ${target}/private/adm/software_version`
  23. endif
  24.  
  25. if ("$sourcevers" == "2.0") then
  26.     set releasename = 2.0
  27. else if ("$sourcevers" == "2.2") then 
  28.     set releasename = 2.2
  29. else if ("$sourcevers" == "2.1J") then 
  30.     set releasename = 2.1J
  31. else if ("$sourcevers" == "2.2J") then 
  32.     set releasename = 2.2J
  33. else if ("$sourcevers" == "3.0 Pre-release1") then 
  34.     set releasename = PR1
  35.     unset docleanup
  36. else if ("$sourcevers" == "3.0 Pre-release2") then 
  37.     set releasename = PR2
  38.     unset docleanup
  39. else if ("$sourcevers" == "3.0") then 
  40.     set releasename = 3.0
  41.     unset docleanup
  42. else if ("$sourcevers" == "3.0J") then 
  43.     set releasename = 3.0J
  44.     unset docleanup
  45. else if ("$sourcevers" == "3.1J") then 
  46.     set releasename = 3.1J
  47.     unset docleanup
  48. else if ("$sourcevers" == "3.1 Prerelease1") then 
  49.     set releasename = 3.1PR1
  50.     unset docleanup
  51. else if ("$sourcevers" == "3.1") then 
  52.     set releasename = 3.1
  53.     unset docleanup
  54. else if ("$sourcevers" == "3.2 Prerelease") then 
  55.     set releasename = 3.2PR
  56.     unset docleanup
  57. else if ("$sourcevers" == "3.2") then 
  58.     set releasename = 3.2
  59.     unset docleanup
  60. else if ("$sourcevers" == "3.2J") then 
  61.     set releasename = 3.2J
  62.     unset docleanup
  63. else if ("$sourcevers" == "2.1") then 
  64.     if (-f ${target}/NextLibrary/References/Webster-Dictionary/CompactDictionary.nxbf) then
  65.         set releasename = 2.1
  66.     else if (-f ${target}/NextApps/WriteNow.app/rtf-wn) then
  67.         set releasename = 2.1I
  68.         if (-f ${target}/usr/lib/NextStep/Displays/NeXTdimension.psdrvr/NDserver) then
  69.             set serversz = `wc -c ${target}/usr/lib/NextStep/Displays/NeXTdimension.psdrvr/NDserver | awk '{print $1}'`
  70.             if ($serversz == 450560) then
  71.                 set releasename = 2.1ND1
  72.             else if ($serversz == 376832) then
  73.                 set releasename = 2.1ND2
  74.             endif
  75.         endif
  76.     else
  77.         set releasename = 2.1RN
  78.     endif
  79. else
  80.     echo "This upgrade can't be used to upgrade Release ${sourcevers}."
  81.     exit 1
  82. endif
  83.  
  84. if (! $?docleanup) then
  85.     # Pre-remove compressed languages to try and free up as much space as possible.
  86.     foreach language (French German Italian Swedish Spanish English)
  87.     set statusfile = ${target}/NextLibrary/Receipts/${language}.pkg/${language}.status
  88.     if (-f $statusfile) then
  89.         if (`/bin/cat $statusfile` == "compressed") then
  90.         echo Removing files for ${language}, which was never used...
  91.         /bin/rm -rf ${target}/NextLibrary/Receipts/${language}.pkg
  92.         endif
  93.     endif
  94.     end
  95.     echo "Upgrade preparation complete."
  96.     exit 0
  97. endif
  98.  
  99. echo -n "Relocating package receipts..."
  100. set nonomatch
  101.  
  102. mkdirs ${target}/NextLibrary/Receipts
  103. chown root.wheel ${target}/NextLibrary/Receipts
  104. chmod 777 ${target}/NextLibrary/Receipts
  105. foreach subdir (Extended Standard ThirdParty)
  106.     mv ${target}/NextLibrary/Packages/${subdir}/* ${target}/NextLibrary/Receipts >& /dev/null
  107. end
  108.  
  109. # Remove old receipts for standard packages.
  110.  
  111. rm -rf ${target}/NextAdmin/Updates_2.1
  112. rm -rf ${target}/NextAdmin/Updates_NeXTdimension
  113. rm -rf ${target}/NextLibrary/Receipts/Update_ND.pkg
  114. rm -rf ${target}/NextLibrary/Receipts/UpdateExtensions_ND.pkg
  115. rm -rf ${target}/NextLibrary/Receipts/Updates_NeXTdimension.pkg
  116. rm -rf ${target}/NextLibrary/Receipts/Update_2.1.pkg
  117. rm -rf ${target}/NextLibrary/Receipts/UpdateExtensions_2.1.pkg
  118. rm -rf ${target}/NextLibrary/Receipts/2.1_Literature.pkg
  119. rm -rf ${target}/NextLibrary/Receipts/2.1_Demonstrations.pkg
  120. rm -rf ${target}/NextLibrary/Receipts/2.1_Documentation.pkg
  121. rm -rf ${target}/NextLibrary/Receipts/2.1_Developer.pkg
  122. rm -rf ${target}/NextLibrary/Receipts/Literature.pkg
  123. rm -rf ${target}/NextLibrary/Receipts/Demonstrations.pkg
  124. rm -rf ${target}/NextLibrary/Receipts/Documentation.pkg
  125. rm -rf ${target}/NextLibrary/Receipts/Developer.pkg
  126. rm -rf ${target}/NextLibrary/Receipts/French.pkg
  127. rm -rf ${target}/NextLibrary/Receipts/German.pkg
  128. rm -rf ${target}/NextLibrary/Receipts/Spanish.pkg
  129. rm -rf ${target}/NextLibrary/Receipts/Italian.pkg
  130. rm -rf ${target}/NextLibrary/Receipts/Swedish.pkg
  131. rm -rf ${target}/NextLibrary/Receipts/2.2*.pkg
  132. rm -rf ${target}/NextLibrary/Receipts/Update_2.2a.pkg
  133.  
  134. echo "done."
  135.  
  136. # Re-configure /usr/template (J-version only)
  137. if (-d ${target}/usr/template/userE) then
  138.     echo -n "Re-configuring ${target}/usr/template/user..."
  139.     rm -rf ${target}/usr/template/user
  140.     cp -rp ${target}/usr/template/userE ${target}/usr/template/user
  141.     echo "done."
  142. endif
  143.  
  144. echo -n "Installing bill of materials for Release ${sourcevers}..."
  145. cp ${source}/Upgrader.app/Default.upgrade/PriorReleases/${releasename}/BaseSystem.bom \
  146.     ${target}/usr/lib/NextStep/BaseSystem.bom
  147. chown root.wheel ${target}/usr/lib/NextStep/BaseSystem.bom    
  148. chmod 644 ${target}/usr/lib/NextStep/BaseSystem.bom
  149. echo "done."
  150.  
  151. if (-d ${target}/NextLibrary/Literature/Shakespeare) then
  152.     set literature
  153. else if (-f ${target}/NextLibrary/References/Webster-Dictionary/pictures/wimple.rtf) then
  154.     set literature
  155. endif
  156. if (-f ${target}/NextLibrary/Documentation/Unix/ManPages/man3/ferror.3s) then
  157.     set doc
  158. else if (-f ${target}/NextLibrary/Documentation/NextDev/NextStep/Reference/03_CFunctions/DPSFuncts.rtf) then
  159.     set doc
  160. endif
  161. if (-f ${target}/NextDeveloper/Demos/Balancer.app/Sound2.snd) then
  162.     set demos
  163. else if (-f ${target}/NextLibrary/Music/Scores/Throb.score) then
  164.     set demos
  165. endif
  166. if (-f ${target}/usr/include/appkit/Scroller.h) then
  167.     set developer
  168. else if (-f ${target}/NextDeveloper/Examples/ScreenSender/BitMoverSpeaker.m) then
  169.     set developer
  170. endif
  171. if (-d ${target}/usr/lib/NextStep/Languages/German) then
  172.     set german
  173. endif
  174. if (-d ${target}/usr/lib/NextStep/Languages/French) then
  175.     set french
  176. endif
  177.  
  178. if ($?literature || $?doc || $?demos || $?developer || $?german || $?french) then
  179.     echo -n "Installing exension package receipts:"
  180. else
  181.     echo "Upgrade preparation complete."
  182.     exit 0
  183. endif
  184.  
  185.  
  186. if ($?literature) then
  187.     rcp -rp ${source}/Upgrader.app/Default.upgrade/PriorReleases/${releasename}/Literature.pkg \
  188.     ${target}/NextLibrary/Receipts/Literature.pkg
  189.     chown -R root.wheel ${target}/NextLibrary/Receipts/Literature.pkg
  190.     echo -n " Literature"
  191. endif
  192. if ($?doc) then
  193.     rcp -rp ${source}/Upgrader.app/Default.upgrade/PriorReleases/${releasename}/Documentation.pkg \
  194.     ${target}/NextLibrary/Receipts/Documentation.pkg
  195.     chown -R root.wheel ${target}/NextLibrary/Receipts/Documentation.pkg
  196.     echo -n " Documentation"
  197. endif
  198. if ($?demos) then
  199.     rcp -rp ${source}/Upgrader.app/Default.upgrade/PriorReleases/${releasename}/Demonstrations.pkg \
  200.     ${target}/NextLibrary/Receipts/Demonstrations.pkg
  201.     chown -R root.wheel ${target}/NextLibrary/Receipts/Demonstrations.pkg
  202.     echo -n " Demonstrations"
  203. endif
  204. if ($?developer) then
  205.     rcp -rp ${source}/Upgrader.app/Default.upgrade/PriorReleases/${releasename}/Developer.pkg \
  206.     ${target}/NextLibrary/Receipts/Developer.pkg
  207.     chown -R root.wheel ${target}/NextLibrary/Receipts/Developer.pkg
  208.     echo -n " Developer"
  209. endif
  210. if ($?french) then
  211.     rcp -rp ${source}/Upgrader.app/Default.upgrade/OldLanguages/French.pkg \
  212.     ${target}/NextLibrary/Receipts/French.pkg
  213.     chown -R root.wheel ${target}/NextLibrary/Receipts/French.pkg
  214.     echo -n " French"
  215. endif
  216. if ($?german) then
  217.     rcp -rp ${source}/Upgrader.app/Default.upgrade/OldLanguages/German.pkg \
  218.     ${target}/NextLibrary/Receipts/German.pkg
  219.     chown -R root.wheel ${target}/NextLibrary/Receipts/German.pkg
  220.     echo -n " German"
  221. endif
  222.  
  223. echo "."
  224. echo "Upgrade preparation complete."
  225.  
  226. exit 0
  227.